<%@ include file="/WEB-INF/jsp/includes.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>浙江孵化器在线后台管理系统---系统管理---短信管理---已发短信列表</title>
    <link href="<spring:url value="/static/style/index.css" htmlEscape="true" />" rel="stylesheet" type="text/css">
</head>
<body>
<div class="list_right_title">
    <span><img src="<spring:url value="/static/images/note_send_icon.png" htmlEscape="true" />" alt="短信管理"></span>系统管理>>短信管理>已发送短信
</div>
<div class="step_mail_title">
    <ul>
        <li><a href="manageSendSms">发送短信</a></li>
        <li><a href="listFailedSmses">未发短信</a></li>
        <li class="step_mail_title_select">已发短信</li>
    </ul>
</div>
<div class="list_right_table_title">
    <div class="list_right_table_title_form">
        <form:form method="post" action="listSuccessSmses" name="multiplyActionForm"
                   id="multiplyActionForm">
            <input type="hidden" name="selectedSuccessSmsIDArray" id="selectedSuccessSmsIDArray"/>
            <input type="submit" value="  删除  " onclick="return checkSelectedSuccessSmses(this.form)"/>
        </form:form>
    </div>
    <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
</div>
<div class="table_box">
    <table class="table" cellspacing="0" cellpadding="0" summary="系统管理>>短信管理>已发短信列表">
        <tr>
            <th nowrap width="3%" align="center">
                <input type="checkbox" id="fatherControlCB" onclick='selectAll()'/>
            </th>
            <th width="6%">
                <img src="<spring:url value="/static/images/step_mail_title_icon.jpg" htmlEscape="true" />" alt="已发短信">
            </th>
            <th width="12%">收件人</th>
            <th width="22%">主题</th>
            <th width="12%">发送时间</th>
        </tr>
        <c:forEach var="successSms" items="${page.result}">
            <tr>
                <td align="center" nowrap><input name="successSmsIndex" type="checkbox" value="${successSms.id}"/>
                </td>
                <td>
                    <img src="<spring:url value="/static/images/step_mail_list_icon.jpg" htmlEscape="true" />"
                         alt="已发短信">
                </td>
                <td nowrap>${successSms.acceptorSms}</td>
                <td align="center" nowrap>${successSms.topic}</td>
                <td align="center" nowrap><fmt:formatDate value="${successSms.updateDatetime}"
                                                          pattern="yyyy-MM-dd HH:mm:ss"/></td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="list_right_table_title">
    <div class="list_right_table_title_form">
        <form:form method="post" action="listSuccessSmses" name="multiplyActionForm2"
                   id="multiplyActionForm2">
            <input type="hidden" name="selectedSuccessSmsIDArray" id="selectedSuccessSmsIDArray2"/>
            <input type="submit" value="  删除  " onclick="return checkSelectedSuccessSmses(this.form)"/>
        </form:form>
    </div>
    <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
</div>
</body>
<script type="text/javascript">
    function getSelectedSuccessSmses() {
        var allSelectedSuccessSmses = new Array();
        var allChkBoxes = document.getElementsByName("successSmsIndex");
        if (allChkBoxes != null)
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == true)
                    allSelectedSuccessSmses[j++] = allChkBoxes[i].value;
            }
        return  allSelectedSuccessSmses;
    }

    function checkSelectedSuccessSmses(formObj) {
        var selectedSuccessSmses = getSelectedSuccessSmses();
        if (selectedSuccessSmses == null || selectedSuccessSmses.length < 1) {
            alert("没有选中项！");
            return false;
        } else {
            var result = window.confirm("你确信要删除所有选中项么?")
            if (!result) {
                return false
            }
            formObj.action = "deleteSuccessSmses";
            document.getElementById("selectedSuccessSmsIDArray").value = selectedSuccessSmses;
            document.getElementById("selectedSuccessSmsIDArray2").value = selectedSuccessSmses;
            return true;
        }
    }

    function selectAll() {
        var allChkBoxes = document.getElementsByName("successSmsIndex");
        if (document.getElementById("fatherControlCB").checked) {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == false) {
                    allChkBoxes[i].checked = true;
                }
            }
        }
        else {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == true) {
                    allChkBoxes[i].checked = false;
                }
            }
        }
    }
</script>

</html>